package com.db.stockexchange.domain;

import java.math.BigDecimal;

public class Price implements Comparable<Price> {
	private BigDecimal price;
	
	public Price(BigDecimal price) {
		this.price = price;
	}
	
	public Price(String s) {
		this(new BigDecimal(s));
	}

	public int getScale() {
		return price.scale();
	}
	
	@Override
	public int compareTo(Price that) {
		return this.price.compareTo(that.price);
	}

	@Override
	public int hashCode() {
		return price.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Price that = (Price) obj;
		return this.price.equals(that.price);
	}

	@Override
	public String toString() {
		return price.toString();
	}
	
	
}
